<%@ page import="java.util.*" %>
<%@ page import="javax.naming.Context" %>
<%@ page import="javax.naming.InitialContext" %>
<%@ page import="edu.columbia.ubms.ejb.MainPageSessionBeanRemote" %>
<%@ page import="edu.columbia.ubms.ejb.BookmarkSessionBeanRemote" %>
<%@ page import="edu.columbia.ubms.ejb.Item" %>

<%@ include file="sessionCheck.jsp"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Main Page Left</title>

<link rel="stylesheet" type="text/css" href="ubms.css" media="screen" />

<script language="javaScript"> 
function openPage(URL) { 
	window.open(URL,'pop','width=1024,height=768'); 
} 
</script>
</head>
<body>

<table>
	<tr>
		<td width="10%">&nbsp;</td>
		<td width="70%">&nbsp;</td>
		<td width="10%">&nbsp;</td>
		<td width="10%" align="right"><a href="bookmarkSearch.jsp">+</a></td>
	</tr>
<% 
	int userId = (Integer)session.getAttribute("userid");

	try {   
    Context ctx = new InitialContext();
	MainPageSessionBeanRemote beanRemote = (MainPageSessionBeanRemote)ctx.lookup("MainPageSessionBean/remote");
	Item item[] = beanRemote.userContentsGet(userId, 'L');
	
    for (int i = 0; i < item.length; i++)
    {
		ctx = new InitialContext();		
		BookmarkSessionBeanRemote beanRemote2 = (BookmarkSessionBeanRemote)ctx.lookup("BookmarkSessionBean/remote");
		Item item2 = beanRemote2.bookmarkGet(item[i].getContentId());      	
%>
	<tr>
		<td>&nbsp;</td>
		<td><a href="#" onClick="parent.frameRight.location.href='<%=item2.getBookmarkUrl()%>'"><%=item2.getBookmarkName()%></a></td>
		<td>&nbsp;</td>
		<td><a href="<%= item2.getBookmarkUrl()%>" onclick="window.open(this.href, 'popupName', 'width=1024, height=768'); return false">^</a></td>
		<td><a href="mainPageContentDelete.jsp?contenttype=L&contentid=<%=item[i].getContentId()%>&mainpageid=<%=item[i].getMainpageId()%>">X</a></td>
	</tr>
<%
    }
} catch(Exception e) {
    out.println("Error:" + e.getMessage());
}
%>
</table>
</body>
</html>